<!--conf
<sample in_favorites="true">
              <product version="1.4" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Tree related API </title>
	
    	
	<link rel="STYLESHEET" type="text/css" href="../../../dhtmlxGrid/codebase/dhtmlxgrid.css">
	<script  src="../../../dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
	<script  src="../../../dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
	<script  src="../../../dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
	<script  src="../../codebase/dhtmlxtreegrid.js"></script>
</head>

<body>
<link rel='STYLESHEET' type='text/css' href='../common/style.css'>
<table cellspacing="0" cellpadding="0" class="sample_header" border="0">
	<tr valign="middle">
		<!-- COMPONENT ICON -->
		<td width="40" align="center"><img src="../common/dhtmlxtreegrid_icon.gif" border="0"></td>
		<!-- COMPONENT NAME -->
		<td width="150" align="left" nowrap="true">Sample: dhtmlxTreeGrid</td>
		<!-- SAMPLE TITLE -->
		<td width="0" align="left" nowrap><b>Tree related API </b></td>
		<!-- LINK TO COMPONENT PAGE -->
		<td width="0" align="right"><a href="http://www.dhtmlx.com/docs/products/dhtmlxTreeGrid/index.shtml">dhtmlxTreeGrid main page</a></td>
		<!-- CLOSE BUTTON -->
		<td width="50"><div class="sample_close"><a href="javascript:void(0);" onclick="self.close();"><img src="../common/sample_close.gif" width="14" height="14" border="0" alt="X"></a></div></td>
	</tr>
</table>
	
	
	<p>
            Use script methods to manipulate TreeGrid
	</p>


	<table width="575">
		<tr>
			<td>
				<div id="gridbox" width="100%" height="150px" style="background-color:white;"></div>
			</td>
		</tr>
		<tr>
			<td>
    <table>
        <tr>
        <td width="50%">
            	<a href="javascript:mygrid.setItemText(mygrid.getSelectedId(),'new text')">setItemText</a><br>
				<a href="javascript:alert(mygrid.getItemText(mygrid.getSelectedId()))">getItemText</a><br><br>

				<a href="javascript:mygrid.setItemCloseable(mygrid.getSelectedId(),false)">set Item Non-Closeable</a><br>
				<a href="javascript:mygrid.setItemCloseable(mygrid.getSelectedId(),true)">set Item Closeable</a><br><br>

				<a href="javascript:mygrid.openItem(mygrid.getSelectedId())">openItem</a><br>
				<a href="javascript:mygrid.closeItem(mygrid.getSelectedId())">closeItem</a><br>
				<a href="javascript:alert(mygrid.getOpenState(mygrid.getSelectedId()))">getOpenState</a><br><br>

        </td>
        <td>
                <a href="javascript:alert(mygrid.getParentId(mygrid.getSelectedId()))">getParentId</a><br>
                <a href="javascript:alert(mygrid.getLevel(mygrid.getSelectedId()))">getLevel</a><br><br>


				<a href="javascript:alert(mygrid.hasChildren(mygrid.getSelectedId()))">hasChildren</a><br>
    			<a href="javascript:alert(mygrid.getSubItems(mygrid.getSelectedId()))">getSubItems</a><br>
                <a href="javascript:alert(mygrid.getAllSubItems(mygrid.getSelectedId()))">getAllSubItems</a><br><br>

				<a href="javascript:alert(mygrid.getChildItemIdByIndex(mygrid.getSelectedId(),0))">getChildItemIdByIndex (first child of selected item)</a><br>
				<a href="javascript:mygrid.deleteChildItems(mygrid.getSelectedId())">deleteChildItems</a><br><br>
        </td>
        </tr>
    </table>




            </td>
		</tr>
	</table>


<script>
		mygrid = new dhtmlXGridObject('gridbox');

		mygrid.selMultiRows = true;
		mygrid.imgURL = "../../../dhtmlxGrid/codebase/imgs/icons_greenfolders/";
		mygrid.setHeader("Tree,Plain Text,Long Text,Color,Checkbox");
		mygrid.setInitWidths("150,100,100,100,100")
		mygrid.setColAlign("left,left,left,left,center")
		mygrid.setColTypes("tree,ed,txt,ch,ch");
		mygrid.setColSorting("str,str,str,na,str")

		mygrid.init();
	   	mygrid.loadXML("test_list_1.xml");
</script>

<!-- FOOTER -->
<table callspacing="0" cellpadding="0" border="0" class="sample_footer"><tr><td style="padding-left: 8px;">&copy; <a href="http://www.dhtmlx.com">DHTMLX LTD</a>. All rights reserved</td></tr></table>
<!-- FOOTER -->

</body>
</html>

